package com.xuerhua.yxt.model;

import java.io.Serializable;

import org.apache.commons.lang.StringUtils;

import com.xuerhua.yxt.utils.StringUtil;

public class Attachment implements Serializable {

	private static final long serialVersionUID = 3011304104336182898L;

	//文件名称
	private String attachmentName;
	//文件类型
	private String attachmentType;
	//文件大小
	private Long attachmentSize;
	//文件源码
	private String baseData;
	//微信媒体id
	private String mediaId;
	//关联类型
	private String relationType;
	//关联id
	private Long relationId;

	public String getAttachmentName() {
		return StringUtil.emptyToNull(attachmentName);
	}

	public void setAttachmentName(String attachmentName) {
		this.attachmentName = attachmentName;
	}

	public String getAttachmentType() {
		return StringUtil.emptyToNull(attachmentType);
	}

	public void setAttachmentType(String attachmentType) {
		this.attachmentType = attachmentType;
	}

	public Long getAttachmentSize() {
		return attachmentSize;
	}

	public void setAttachmentSize(Long attachmentSize) {
		this.attachmentSize = attachmentSize;
	}

	public String getBaseData() {
		return StringUtil.emptyToNull(baseData);
	}

	public void setBaseData(String baseData) {
		this.baseData = baseData;
	}
	
	public String getMediaId() {
		return StringUtil.emptyToNull(mediaId);
	}

	public void setMediaId(String mediaId) {
		this.mediaId = mediaId;
	}

	public String getExtName() {
		if(StringUtils.isNotBlank(attachmentName)) {
			return attachmentName.substring(attachmentName.lastIndexOf(".") + 1, attachmentName.length());
		}
		return null;
	}

	public String getRelationType() {
		return StringUtil.emptyToNull(relationType);
	}

	public void setRelationType(String relationType) {
		this.relationType = relationType;
	}

	public Long getRelationId() {
		return relationId;
	}

	public void setRelationId(Long relationId) {
		this.relationId = relationId;
	}
	
}
